Skip to content

fix(k8s_utils): close namespace file handle with context manager#1033

Merged
openshift-merge-bot[bot] merged 1 commit into
project-codeflare:mainfrom
kryanbeane:ambient-test
Mar 30, 2026
Merged

fix(k8s_utils): close namespace file handle with context manager#1033
openshift-merge-bot[bot] merged 1 commit into
project-codeflare:mainfrom
kryanbeane:ambient-test

Conversation

@kryanbeane

@kryanbeane kryanbeane commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

get_current_namespace() opened the in-cluster namespace file with a bare open() call, leaking a file descriptor on every invocation in long-running processes. Replace with a with statement to guarantee the file is closed on exit.

Fixes RHOAIENG-54703

Issue link

What changes have been made

Verification steps

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

get_current_namespace() opened the in-cluster namespace file with a
bare open() call, leaking a file descriptor on every invocation in
long-running processes. Replace with a with statement to guarantee
the file is closed on exit.

Fixes RHOAIENG-54703

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Mar 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.15%. Comparing base (d87aac4) to head (4411282).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1033   +/-   ##
=======================================
  Coverage   96.15%   96.15%           
=======================================
  Files          23       23           
  Lines        2238     2238           
=======================================
  Hits         2152     2152           
  Misses         86       86           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@laurafitzgerald

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Mar 25, 2026
@laurafitzgerald

Copy link
Copy Markdown
Contributor

/approve

Change looks good — correct use of context manager, semantically equivalent to the original. Given the function is # pragma: no cover, please tick "Testing is not required for this change" in the PR checklist to keep things clean.

@openshift-ci

openshift-ci Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: laurafitzgerald

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit e1110cf into project-codeflare:main Mar 30, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants